Skip to content

Add ConanVersionRange class and test - #102

Merged
pombredanne merged 119 commits into
mainfrom
101-univers-support-for-conan
Mar 10, 2023
Merged

Add ConanVersionRange class and test#102
pombredanne merged 119 commits into
mainfrom
101-univers-support-for-conan

Conversation

@johnmhoran

@johnmhoran johnmhoran commented Feb 23, 2023

Copy link
Copy Markdown
Member

lasote and others added 30 commits December 1, 2015 14:18
* Upload/Download retries + upload errors + wilcard upload

* Remove xrange

* Py3 exception message removed

* Upload url

* failing test with order in py3

* Revision memsharded

* Not retry when a 404 or other controlled error happen
* Fixes sums with pyc and output error with non ascii. Also added messages to retry commands

* Removed log

* Exclude pyc from packages and manifests

* New test, exclude pyc in loads

* New test, exclude pyc in loads

* Moved retry to uploader_downloader, removed UploadException, changed error message with remotes
* patch, pre, build to Version

* patch, pre, build to Version

* reverted to default stable() behavior

* fixed broken Version() test
* build_requires in recipes

* decoupling source folder

* tests for local edition and no_copy_sources

* fixed broken py3 test

* fixed broken py3 test

* fixed issue with local package build_folder nested

* Ok

* Fixed tests

* PR: Revision

@TG1999 TG1999 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, few nits for your consideration

Comment thread src/univers/version_range.py Outdated
"nuget": "nuget",
"pypi": "pypi",
"packagist": "composer",
"conan1": "conan1",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be "conan" : "conan1" since gitlab uses conan in their package slug

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @TG1999. I made the change yesterday to conan1 to address an error I was getting when running this test:

pytest -vvs tests/test_version_range.py::test_conan_gitlab_version_range_parse

I just made the change you requested and reran that test, and again I get the same error. Here's an excerpt from a large terminal output:

(venv) Fri Feb 24, 2023 10:00 AM  /home/jmh/dev/nexb/univers jmh (101-univers-support-for-conan)
$ pytest -vvs tests/test_version_range.py::test_conan_gitlab_version_range_parse

[...]

=================================================================================================== FAILURES ====================================================================================================
_______________________________________________________________________________ test_conan_gitlab_version_range_parse[test_case0] _______________________________________________________________________________

test_case = {'expected_vers': 'vers:conan1/>=5.1.0|<=5.1.1', 'native': '>=5.1.0 <=5.1.1', 'scheme': 'conan1', 'test_index': 1}

    @pytest.mark.parametrize("test_case", json.load(open("./tests/data/conan_advisory.json")))
    def test_conan_gitlab_version_range_parse(test_case):
        if test_case["expected_vers"] is None:
            with pytest.raises(InvalidVersion):
                Conan1VersionRange.from_native(string=test_case["native"])
            return
>       result = from_gitlab_native(
            gitlab_scheme=test_case["scheme"],
            string=test_case["native"],
        )

tests/test_version_range.py:364:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

gitlab_scheme = 'conan1', string = '>=5.1.0 <=5.1.1'

    def from_gitlab_native(gitlab_scheme, string):
>       purl_scheme = PURL_TYPE_BY_GITLAB_SCHEME[gitlab_scheme]
E       KeyError: 'conan1'

src/univers/version_range.py:1106: KeyError

[...]

========================================================================================= 427 failed, 1 passed in 8.87s =========================================================================================

(venv) Fri Feb 24, 2023 10:00 AM  /home/jmh/dev/nexb/univers jmh (101-univers-support-for-conan)
$

I was unable to identify the source of this error -- do you have any suggestions?

Meanwhile, I will implement your other comments and see if that resolves this set of error messages.

{
"test_index": 1,
"scheme": "conan1",
"native": ">=5.1.0 <=5.1.1",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a parameter "gitlab_scheme" : "conan" in every test here.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TG1999 Very interesting -- I'm getting a better sense of the structure we need for the gitlab advisory data. I've followed your suggestion and the JSON objects now look like this:

  {
    "test_index": 1,
    "scheme": "conan1",
    "native": ">=5.1.0 <=5.1.1",
    "expected_vers": "vers:conan1/>=5.1.0|<=5.1.1",
    "gitlab_scheme": "conan"
  },

Comment thread tests/test_version_range.py Outdated
Conan1VersionRange.from_native(string=test_case["native"])
return
result = from_gitlab_native(
gitlab_scheme=test_case["scheme"],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
gitlab_scheme=test_case["scheme"],
gitlab_scheme=test_case["gitlab_scheme"],

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Outstanding @TG1999 -- with this and the 2 other sets of changes, all 428 of the test cases pass both Conan-related tests.

Thank you. 🙂 Will commit and push shortly.

Reference: #101

Signed-off-by: John M. Horan <johnmhoran@gmail.com>
@johnmhoran
johnmhoran requested a review from TG1999 February 24, 2023 22:14

@TG1999 TG1999 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@TG1999
TG1999 requested a review from pombredanne February 27, 2023 11:46
memsharded and others added 7 commits February 27, 2023 18:10
Reference: #101

Signed-off-by: John M. Horan <johnmhoran@gmail.com>
Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>
Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>
Signed-off-by: John M. Horan <johnmhoran@gmail.com>
@johnmhoran

Copy link
Copy Markdown
Member Author

In src/univers/version_range.py, there's an s missing in from univers.conan.version_range import VersionRange as conan_verion_range.

@TG1999
TG1999 force-pushed the 101-univers-support-for-conan branch from d5b29bb to 9f8c49a Compare March 2, 2023 17:24
Signed-off-by: Tushar Goel <tushar.goel.dav@gmail.com>
@TG1999
TG1999 force-pushed the 101-univers-support-for-conan branch from 9f8c49a to 48dc602 Compare March 2, 2023 17:27

@pombredanne pombredanne left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't you need an __init__.py in the conan directory?
I would rather have a regular package than an implicit namespace package.

@pombredanne pombredanne left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are missing the ABOUT and license/notice files

Comment thread src/univers/conan/errors.py
@johnmhoran

Copy link
Copy Markdown
Member Author

@pombredanne @TG1999 I've added an __init__.py file in the /univers/conan/ directory.

@johnmhoran

johnmhoran commented Mar 8, 2023

Copy link
Copy Markdown
Member Author

@pombredanne @TG1999 I've also added a pair of .ABOUT/.NOTICE files for each of errors.py, version_range.py and version.py, and have hand-crafted each of the .ABOUT files. (Should the latter files somehow have been tool-generated?)

Reference: #101

Signed-off-by: John M. Horan <johnmhoran@gmail.com>
@johnmhoran

Copy link
Copy Markdown
Member Author

@pombredanne @TG1999 I just committed and pushed and immediately saw that a GH check has failed --

https://github.com/nexB/univers/pull/102/checks?check_run_id=11840361414

There are 66 commits incorrectly signed off. This means that the author(s) of these commits failed to include a Signed-off-by line in their commit message.

I suspect these sign-off errors are from the commit histories of conan files added from the JFrog repo.

How do we handle this?

@johnmhoran

Copy link
Copy Markdown
Member Author

It's odd that this GH check would have failed after I committed and pushed my limited changes -- the JFrog Conan code had already been added by @TG1999 , and I retrieved it with a git pull. But somehow something I introduced triggered this . . . .

@TG1999

TG1999 commented Mar 8, 2023

Copy link
Copy Markdown
Contributor

@johnmhoran thanks for adding the ABOUT files, we cannot do a lot for the DCO failing here because of reusing Conan commit history I have set DCO to pass.

@pombredanne pombredanne left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@johnmhoran Thanks... just one last nitpicking to add ABOUT files for the test code (and headers)

Comment thread tests/test_conan_version_range.py
Comment thread tests/test_conan_version_comparison.py
Comment thread tests/test_conan_version_bump.py
Reference: #101

Signed-off-by: John M. Horan <johnmhoran@gmail.com>

@pombredanne pombredanne left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks!

@pombredanne
pombredanne merged commit d38d9fd into main Mar 10, 2023
@pombredanne
pombredanne deleted the 101-univers-support-for-conan branch March 10, 2023 16:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.